package com.ruoyi.base.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.base.domain.BusWaterSegmentattribute;
import com.ruoyi.base.service.IBusWaterSegmentattributeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 断面控制级别、属性等数据Controller
 * 
 * @author ruoyi
 * @date 2025-07-30
 */
@RestController
@RequestMapping("/base/segmentattribute")
public class BusWaterSegmentattributeController extends BaseController
{
    @Autowired
    private IBusWaterSegmentattributeService busWaterSegmentattributeService;

    /**
     * 查询断面控制级别、属性等数据列表
     */
    //@PreAuthorize("@ss.hasPermi('base:segmentattribute:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusWaterSegmentattribute busWaterSegmentattribute)
    {
        startPage();
        List<BusWaterSegmentattribute> list = busWaterSegmentattributeService.selectBusWaterSegmentattributeList(busWaterSegmentattribute);
        return getDataTable(list);
    }

    /**
     * 导出断面控制级别、属性等数据列表
     */
//    @PreAuthorize("@ss.hasPermi('base:segmentattribute:export')")
//    @Log(title = "断面控制级别、属性等数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusWaterSegmentattribute busWaterSegmentattribute)
    {
        List<BusWaterSegmentattribute> list = busWaterSegmentattributeService.selectBusWaterSegmentattributeList(busWaterSegmentattribute);
        ExcelUtil<BusWaterSegmentattribute> util = new ExcelUtil<BusWaterSegmentattribute>(BusWaterSegmentattribute.class);
        util.exportExcel(response, list, "断面控制级别、属性等数据数据");
    }

    /**
     * 获取断面控制级别、属性等数据详细信息
     */
    //@PreAuthorize("@ss.hasPermi('base:segmentattribute:query')")
    @GetMapping(value = "/getinfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busWaterSegmentattributeService.selectBusWaterSegmentattributeById(id));
    }

    /**
     * 新增断面控制级别、属性等数据
     */
//    @PreAuthorize("@ss.hasPermi('base:segmentattribute:add')")
//    @Log(title = "断面控制级别、属性等数据", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody BusWaterSegmentattribute busWaterSegmentattribute)
    {
        return toAjax(busWaterSegmentattributeService.insertBusWaterSegmentattribute(busWaterSegmentattribute));
    }

    /**
     * 修改断面控制级别、属性等数据
     */
//    @PreAuthorize("@ss.hasPermi('base:segmentattribute:edit')")
//    @Log(title = "断面控制级别、属性等数据", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody BusWaterSegmentattribute busWaterSegmentattribute)
    {
        return toAjax(busWaterSegmentattributeService.updateBusWaterSegmentattribute(busWaterSegmentattribute));
    }

    /**
     * 删除断面控制级别、属性等数据
     */
//    @PreAuthorize("@ss.hasPermi('base:segmentattribute:remove')")
//    @Log(title = "断面控制级别、属性等数据", businessType = BusinessType.DELETE)
	@GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busWaterSegmentattributeService.deleteBusWaterSegmentattributeByIds(ids));
    }
}
